#ifndef __COM_DEVICE_H
#define __COM_DEVICE_H
#include <stdint.h>
typedef struct timestamp_s {
  uint8_t year;
  uint8_t month;
  uint8_t day;
  uint8_t hour;
  uint8_t minute;
  uint8_t second;
  uint16_t subsec;
} timestamp_t;

typedef struct com_dev_s {
  char name[16];
  uint32_t timestamp;
  int32_t (*write)(void*, int32_t);
  int32_t (*read)(void*, int32_t);
  int32_t (*irq_callback)(void*);
  int32_t recv_size;
  uint8_t *recv_buf;
  int32_t send_size;
  uint8_t *send_buf;
  struct com_dev_s *next;
} com_dev_t;
extern com_dev_t *com_list_head;
extern com_dev_t dev_uart1;
extern com_dev_t dev_uart2;
extern com_dev_t dev_uart3;
int com_device_init(void);
void com_irq_register(com_dev_t *p_com, int32_t (*callback_entry)(void*));
#endif
